Create Experiment
curl --request POST \
--url https://api.sophra.org/api/nous/ab-testing/experiments \
--header 'Content-Type: application/json' \
--data '
{
"name": "search-ranking-test",
"description": "Testing new search ranking algorithm",
"startDate": "2024-03-25T00:00:00Z",
"endDate": "2024-04-25T00:00:00Z",
"configuration": {
"variants": [
{
"id": "control",
"name": "Control Group",
"weight": 0.5,
"config": {
"layout": "standard",
"resultsPerPage": 10,
"showThumbnails": true
}
},
{
"id": "variant_a",
"name": "Test Variant",
"weight": 0.5,
"config": {
"layout": "enhanced",
"resultsPerPage": 15,
"showThumbnails": true
}
}
],
"trafficAllocation": 0.2,
"targetMetrics": [
"click_through_rate",
"conversion_rate"
]
}
}
'import requests
url = "https://api.sophra.org/api/nous/ab-testing/experiments"
payload = {
"name": "search-ranking-test",
"description": "Testing new search ranking algorithm",
"startDate": "2024-03-25T00:00:00Z",
"endDate": "2024-04-25T00:00:00Z",
"configuration": {
"variants": [
{
"id": "control",
"name": "Control Group",
"weight": 0.5,
"config": {
"layout": "standard",
"resultsPerPage": 10,
"showThumbnails": True
}
},
{
"id": "variant_a",
"name": "Test Variant",
"weight": 0.5,
"config": {
"layout": "enhanced",
"resultsPerPage": 15,
"showThumbnails": True
}
}
],
"trafficAllocation": 0.2,
"targetMetrics": ["click_through_rate", "conversion_rate"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'search-ranking-test',
description: 'Testing new search ranking algorithm',
startDate: '2024-03-25T00:00:00Z',
endDate: '2024-04-25T00:00:00Z',
configuration: {
variants: [
{
id: 'control',
name: 'Control Group',
weight: 0.5,
config: {layout: 'standard', resultsPerPage: 10, showThumbnails: true}
},
{
id: 'variant_a',
name: 'Test Variant',
weight: 0.5,
config: {layout: 'enhanced', resultsPerPage: 15, showThumbnails: true}
}
],
trafficAllocation: 0.2,
targetMetrics: ['click_through_rate', 'conversion_rate']
}
})
};
fetch('https://api.sophra.org/api/nous/ab-testing/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/nous/ab-testing/experiments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'search-ranking-test',
'description' => 'Testing new search ranking algorithm',
'startDate' => '2024-03-25T00:00:00Z',
'endDate' => '2024-04-25T00:00:00Z',
'configuration' => [
'variants' => [
[
'id' => 'control',
'name' => 'Control Group',
'weight' => 0.5,
'config' => [
'layout' => 'standard',
'resultsPerPage' => 10,
'showThumbnails' => true
]
],
[
'id' => 'variant_a',
'name' => 'Test Variant',
'weight' => 0.5,
'config' => [
'layout' => 'enhanced',
'resultsPerPage' => 15,
'showThumbnails' => true
]
]
],
'trafficAllocation' => 0.2,
'targetMetrics' => [
'click_through_rate',
'conversion_rate'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sophra.org/api/nous/ab-testing/experiments"
payload := strings.NewReader("{\n \"name\": \"search-ranking-test\",\n \"description\": \"Testing new search ranking algorithm\",\n \"startDate\": \"2024-03-25T00:00:00Z\",\n \"endDate\": \"2024-04-25T00:00:00Z\",\n \"configuration\": {\n \"variants\": [\n {\n \"id\": \"control\",\n \"name\": \"Control Group\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"standard\",\n \"resultsPerPage\": 10,\n \"showThumbnails\": true\n }\n },\n {\n \"id\": \"variant_a\",\n \"name\": \"Test Variant\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"enhanced\",\n \"resultsPerPage\": 15,\n \"showThumbnails\": true\n }\n }\n ],\n \"trafficAllocation\": 0.2,\n \"targetMetrics\": [\n \"click_through_rate\",\n \"conversion_rate\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sophra.org/api/nous/ab-testing/experiments")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"search-ranking-test\",\n \"description\": \"Testing new search ranking algorithm\",\n \"startDate\": \"2024-03-25T00:00:00Z\",\n \"endDate\": \"2024-04-25T00:00:00Z\",\n \"configuration\": {\n \"variants\": [\n {\n \"id\": \"control\",\n \"name\": \"Control Group\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"standard\",\n \"resultsPerPage\": 10,\n \"showThumbnails\": true\n }\n },\n {\n \"id\": \"variant_a\",\n \"name\": \"Test Variant\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"enhanced\",\n \"resultsPerPage\": 15,\n \"showThumbnails\": true\n }\n }\n ],\n \"trafficAllocation\": 0.2,\n \"targetMetrics\": [\n \"click_through_rate\",\n \"conversion_rate\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sophra.org/api/nous/ab-testing/experiments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"search-ranking-test\",\n \"description\": \"Testing new search ranking algorithm\",\n \"startDate\": \"2024-03-25T00:00:00Z\",\n \"endDate\": \"2024-04-25T00:00:00Z\",\n \"configuration\": {\n \"variants\": [\n {\n \"id\": \"control\",\n \"name\": \"Control Group\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"standard\",\n \"resultsPerPage\": 10,\n \"showThumbnails\": true\n }\n },\n {\n \"id\": \"variant_a\",\n \"name\": \"Test Variant\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"enhanced\",\n \"resultsPerPage\": 15,\n \"showThumbnails\": true\n }\n }\n ],\n \"trafficAllocation\": 0.2,\n \"targetMetrics\": [\n \"click_through_rate\",\n \"conversion_rate\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"experimentId": "<string>",
"status": "created",
"variants": [
{}
]
}
}Nous > A/B Testing
Create Experiment
POST
/
nous
/
ab-testing
/
experiments
Create Experiment
curl --request POST \
--url https://api.sophra.org/api/nous/ab-testing/experiments \
--header 'Content-Type: application/json' \
--data '
{
"name": "search-ranking-test",
"description": "Testing new search ranking algorithm",
"startDate": "2024-03-25T00:00:00Z",
"endDate": "2024-04-25T00:00:00Z",
"configuration": {
"variants": [
{
"id": "control",
"name": "Control Group",
"weight": 0.5,
"config": {
"layout": "standard",
"resultsPerPage": 10,
"showThumbnails": true
}
},
{
"id": "variant_a",
"name": "Test Variant",
"weight": 0.5,
"config": {
"layout": "enhanced",
"resultsPerPage": 15,
"showThumbnails": true
}
}
],
"trafficAllocation": 0.2,
"targetMetrics": [
"click_through_rate",
"conversion_rate"
]
}
}
'import requests
url = "https://api.sophra.org/api/nous/ab-testing/experiments"
payload = {
"name": "search-ranking-test",
"description": "Testing new search ranking algorithm",
"startDate": "2024-03-25T00:00:00Z",
"endDate": "2024-04-25T00:00:00Z",
"configuration": {
"variants": [
{
"id": "control",
"name": "Control Group",
"weight": 0.5,
"config": {
"layout": "standard",
"resultsPerPage": 10,
"showThumbnails": True
}
},
{
"id": "variant_a",
"name": "Test Variant",
"weight": 0.5,
"config": {
"layout": "enhanced",
"resultsPerPage": 15,
"showThumbnails": True
}
}
],
"trafficAllocation": 0.2,
"targetMetrics": ["click_through_rate", "conversion_rate"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'search-ranking-test',
description: 'Testing new search ranking algorithm',
startDate: '2024-03-25T00:00:00Z',
endDate: '2024-04-25T00:00:00Z',
configuration: {
variants: [
{
id: 'control',
name: 'Control Group',
weight: 0.5,
config: {layout: 'standard', resultsPerPage: 10, showThumbnails: true}
},
{
id: 'variant_a',
name: 'Test Variant',
weight: 0.5,
config: {layout: 'enhanced', resultsPerPage: 15, showThumbnails: true}
}
],
trafficAllocation: 0.2,
targetMetrics: ['click_through_rate', 'conversion_rate']
}
})
};
fetch('https://api.sophra.org/api/nous/ab-testing/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/nous/ab-testing/experiments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'search-ranking-test',
'description' => 'Testing new search ranking algorithm',
'startDate' => '2024-03-25T00:00:00Z',
'endDate' => '2024-04-25T00:00:00Z',
'configuration' => [
'variants' => [
[
'id' => 'control',
'name' => 'Control Group',
'weight' => 0.5,
'config' => [
'layout' => 'standard',
'resultsPerPage' => 10,
'showThumbnails' => true
]
],
[
'id' => 'variant_a',
'name' => 'Test Variant',
'weight' => 0.5,
'config' => [
'layout' => 'enhanced',
'resultsPerPage' => 15,
'showThumbnails' => true
]
]
],
'trafficAllocation' => 0.2,
'targetMetrics' => [
'click_through_rate',
'conversion_rate'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sophra.org/api/nous/ab-testing/experiments"
payload := strings.NewReader("{\n \"name\": \"search-ranking-test\",\n \"description\": \"Testing new search ranking algorithm\",\n \"startDate\": \"2024-03-25T00:00:00Z\",\n \"endDate\": \"2024-04-25T00:00:00Z\",\n \"configuration\": {\n \"variants\": [\n {\n \"id\": \"control\",\n \"name\": \"Control Group\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"standard\",\n \"resultsPerPage\": 10,\n \"showThumbnails\": true\n }\n },\n {\n \"id\": \"variant_a\",\n \"name\": \"Test Variant\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"enhanced\",\n \"resultsPerPage\": 15,\n \"showThumbnails\": true\n }\n }\n ],\n \"trafficAllocation\": 0.2,\n \"targetMetrics\": [\n \"click_through_rate\",\n \"conversion_rate\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sophra.org/api/nous/ab-testing/experiments")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"search-ranking-test\",\n \"description\": \"Testing new search ranking algorithm\",\n \"startDate\": \"2024-03-25T00:00:00Z\",\n \"endDate\": \"2024-04-25T00:00:00Z\",\n \"configuration\": {\n \"variants\": [\n {\n \"id\": \"control\",\n \"name\": \"Control Group\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"standard\",\n \"resultsPerPage\": 10,\n \"showThumbnails\": true\n }\n },\n {\n \"id\": \"variant_a\",\n \"name\": \"Test Variant\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"enhanced\",\n \"resultsPerPage\": 15,\n \"showThumbnails\": true\n }\n }\n ],\n \"trafficAllocation\": 0.2,\n \"targetMetrics\": [\n \"click_through_rate\",\n \"conversion_rate\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sophra.org/api/nous/ab-testing/experiments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"search-ranking-test\",\n \"description\": \"Testing new search ranking algorithm\",\n \"startDate\": \"2024-03-25T00:00:00Z\",\n \"endDate\": \"2024-04-25T00:00:00Z\",\n \"configuration\": {\n \"variants\": [\n {\n \"id\": \"control\",\n \"name\": \"Control Group\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"standard\",\n \"resultsPerPage\": 10,\n \"showThumbnails\": true\n }\n },\n {\n \"id\": \"variant_a\",\n \"name\": \"Test Variant\",\n \"weight\": 0.5,\n \"config\": {\n \"layout\": \"enhanced\",\n \"resultsPerPage\": 15,\n \"showThumbnails\": true\n }\n }\n ],\n \"trafficAllocation\": 0.2,\n \"targetMetrics\": [\n \"click_through_rate\",\n \"conversion_rate\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"experimentId": "<string>",
"status": "created",
"variants": [
{}
]
}
}Body
application/json

